home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q0705.dms / q0705.adf / Amiga / Appendices / Examples / IntuitionExamples.doc < prev    next >
Text File  |  1992-07-29  |  15KB  |  444 lines

  1. 2    INTUITION
  2.  
  3. 2.1  SCREENS
  4.  
  5. Example1
  6.   This program will open a low-resolution, non-Interlaced,
  7.   eight colour Custom Screen. It will display it for 30
  8.   seconds, and then close it.
  9.  
  10. Example2
  11.   Same as Example1 except that the screen will be a high-
  12.   resolution, Interlaced, 4 colour Custom Screen.
  13.  
  14. Example3
  15.   Same as Example1 except that we will use the TOPAZ_SIXTY
  16.   Italic style as default font. (See chapter 3 GRAPHICS for
  17.   more information about text styles.)
  18.  
  19. Example4
  20.   This program will open two screens, one (low-resolution 32
  21.   colours) at the top of the display, and one (high-resolution
  22.   16 colours) a bit down.
  23.  
  24. Example5
  25.   Same as Example4 except that after 10 seconds the low-
  26.   resolution screen will move down 75 lines. After another 10
  27.   seconds it will be put in front of all other screens. 10
  28.   seconds later it will move down another 75 lines. The program
  29.   will wait 10 seconds before the screens are closed and the
  30.   program exits.
  31.  
  32. Example6
  33.   This program will open a low-resolution, non-Interlaced, 4
  34.   colour Custom Screen. It will after 5 seconds start to change
  35.   the screens colours, and will after a while close the screen
  36.   and exit.
  37.  
  38.  
  39.  
  40. 2.2  WINDOWS
  41.  
  42. Example1
  43.   This program will open a normal window which is connected to
  44.   the Workbench Screen. It will display it for 30 seconds, and
  45.   then close it.
  46.  
  47. Example2
  48.   This program will open a high resolution 16 colour Custom
  49.   Screen and a normal window which is connected to it. It will
  50.   display it for 30 seconds, and then close the Custom Screen
  51.   and the window.
  52.  
  53. Example3
  54.   This program will open a normal window which is connected to
  55.   the Workbench Screen. The window will use all System Gadgets,
  56.   and will automatically Activate the window. It will display
  57.   it for 30 seconds, and then close it. (Remember that the
  58.   Close Gadget does NOT close the window by itself, it will
  59.   only inform you that the user wants to close it. But in
  60.   this example we will not listen to what the user wants.)
  61.  
  62. Example4
  63.   This program will open two normal windows which are connected
  64.   to the Workbench Screen. The windows will use all System
  65.   Gadgets. It will display them for 30 seconds, and then close
  66.   them.
  67.  
  68. Example5
  69.   This program will open a Borderless window which is connected
  70.   to the Workbench Screen. It will display it for 30 seconds,
  71.   and then quit.
  72.  
  73. Example6
  74.   Same as Example5 except that the window will also use all
  75.   System Gadgets.
  76.  
  77. Example7
  78.   This program will open three windows, two are normal and the
  79.   third is a Backdrop window. The windows will use all System
  80.   Gadgets, except the Backdrop window, which only can use the
  81.   close-window gadget. After 30 seconds the program quits. (Try
  82.   to push either window 1 or 2 behind the Backdrop window.)
  83.  
  84. Example8
  85.   This program will open a SuperBitMap window which is
  86.   connected to the Workbench Screen. Since it is a SuperBitMap
  87.   we also make the window into a Gimmezerozero window. The
  88.   window will use all System Gadgets, and some boxes will be
  89.   drawn. It will display the window for 30 seconds, and then
  90.   close it. (Shrink the window, and then enlarge it again, and
  91.   you will noticed that the lines are still there!)
  92.  
  93. Example9
  94.   This program will open a normal window with all system
  95.   gadgets connected to it. If you activate the window, the
  96.   pointer will change shapes into a "nice" arrow.
  97.  
  98. Example10
  99.   This program will open a two normal windows with all system
  100.   gadgets connected to them. If the first window is Activated,
  101.   the pointer will change shapes into a Zzz symbol, if the
  102.   second window is activated, the pointer will look like a
  103.   pistol.
  104.  
  105.  
  106.  
  107. 2.3  GRAPHICS
  108.  
  109. Example1
  110.   This program will open a normal window which is connected to
  111.   the Workbench Screen. We will then draw a strange line with
  112.   help of Intuition's Border structure.
  113.  
  114. Example2
  115.   This program will open a normal window which is connected to
  116.   the Workbench Screen. We will then draw two rectangles with
  117.   different colours. This shows how you can link Border
  118.   structures to each other in order to get the desired effects.
  119.  
  120. Example3
  121.   This program will open a normal window which is connected to
  122.   the Workbench Screen. We will then print a text string with
  123.   help of Intuition's IntuiText structure.
  124.  
  125. Example4
  126.   Same as Example3 except that the text will be printed with
  127.   underlined italic characters.
  128.  
  129. Example5
  130.   This program will open a normal window which is connected to
  131.   the Workbench Screen. We will then draw the little nice arrow
  132.   we talked so much about.
  133.  
  134. Example6
  135.   Same as Example5 except that we will draw it several times in
  136.   different colours. This shows how PlanePick/PlaneOnOff works.
  137.  
  138. Example7
  139.   This program will open a normal window which is connected to
  140.   the Workbench Screen. We will then draw the nice 4 colour
  141.   face that was described in chapter 3.5 IMAGES.
  142.  
  143. Example8
  144.   This program will open a normal window which is connected to
  145.   a 16-colour Custom screen. In the window we will draw the
  146.   famous AMIGA-logo.
  147.  
  148.  
  149.  
  150. 2.4  GADGETS
  151.  
  152. Example1
  153.   This program will open a normal window which is connected to
  154.   the Workbench Screen. The window will use all System
  155.   Gadgets, and will close first when the user has selected the
  156.   System gadget Close window. (Same as Example3 in chapter 2
  157.   WINDOWS, except that we have added an IDCMP check on the
  158.   Close window gadget.)
  159.  
  160. Example2
  161.   Same as Example1 except that we have added a Boolean gadget
  162.   with the text "PRESS ME".
  163.  
  164. Example3
  165.   Same as Example2 except that the on/off state of the gadget
  166.   is toggled each time the user hits the gadget.
  167.  
  168. Example4
  169.   This program will open a normal window which is connected to
  170.   the Workbench Screen. The window will use all System
  171.   Gadgets, and will close first when the user has selected
  172.   the System gadget Close window. Inside the window we have put
  173.   two Boolean gadgets with the text "GADGET 1" and "GADGET 2".
  174.  
  175. Example5
  176.   This program will open a normal window which is connected to
  177.   the Workbench Screen. The window will use all System Gadgets,
  178.   and will close first when the user has selected the System
  179.   gadget Close window. Inside the window we have put a Boolean
  180.   gadget with two Image structures connected to it. Each time
  181.   the user clicks on the gadget it will change images, lamp
  182.   on/lamp off.
  183.  
  184. Example6
  185.   This program will open a normal window which is connected
  186.   to the Workbench Screen. The window will use all System
  187.   Gadgets, and will close first when the user has selected the
  188.   System gadget Close window. Inside the window we have put a
  189.   Boolean gadget with a connecting mask. The gadget will only
  190.   be highlighted when the user selects this gadget while
  191.   pointing inside the specified (masked) area.
  192.  
  193. Example7
  194.   This program will open a normal window which is connected to
  195.   the Workbench Screen. The window will use all System
  196.   Gadgets, and will close first when the user has selected the
  197.   System gadget Close window. Inside the window we have put a
  198.   String gadget.
  199.  
  200. Example8
  201.   Same as Example7 except that it is an Integer gadget.
  202.  
  203. Example9
  204.   Same as Example7 except that it is a Proportional gadget.
  205.  
  206. Example10
  207.   Same as Example9 except that the Proportional gadget uses a
  208.   custom image knob.
  209.  
  210. Example11
  211.   This program will open a normal window which is connected to
  212.   the Workbench Screen. The window will use all System
  213.   Gadgets, and will close first when the user has selected the
  214.   System gadget Close window. Inside the window we have put a
  215.   Proportional gadget where the knob can be moved both
  216.   horizontally and vertically.
  217.  
  218. Example12
  219.   This program will open a SuperBitmap window which is
  220.   connected to the Workbench Screen. The window will use all
  221.   System Gadgets, and will close first when the user has
  222.   selected the System gadget Close window. Inside the window we
  223.   have put two Proportional gadgets, one on the right side, and
  224.   one at the bottom. With help of these two gadgets, the user
  225.   can move around the BitMap.
  226.  
  227.   This example is for experienced programmers only, since it
  228.   uses some functions etc which we have not discussed yet. I
  229.   have, however, included it here since it is a good example on
  230.   how you can combine Proportional gadgets with SuperBitmap
  231.   windows.
  232.  
  233. Example13
  234.   This example demonstrates how to use six string gadgets which
  235.   are automatically activated (selected) when the user release
  236.   the gadget above.
  237.  
  238.  
  239.  
  240. 2.5  REQUESTERS
  241.  
  242. Example1
  243.   This example opens a Simple requester by calling the function
  244.   AutoRequest. It displays a message "This is a very simple
  245.   requester!", and has only one gadget connected to it (on the
  246.   right side of the requester) with the text "OK".
  247.  
  248. Example2
  249.   Same as Example1, except that the requester displays a
  250.   message "Do you really want to quit?", and allows the user to
  251.   choose between "Yes" and "No". The program  will continue to
  252.   reopen the requester until the user has chosen "Yes".
  253.  
  254. Example3
  255.   Same as Example1, except that this requester displays a
  256.   message "Insert a disk in any drive!", and allows the user to
  257.   choose between "Yes" and "No". The program will continue to
  258.   reopen the requester until the user has chosen "Yes" or
  259.   inserted a disk.
  260.  
  261. Example4
  262.   This program will open a normal window which is connected to
  263.   the Workbench Screen. The window will use all System Gadgets,
  264.   and will close first when the user has selected the System
  265.   gadget Close window. Inside the window we have activated an
  266.   Application requester with a connecting gadget. The requester
  267.   will first be satisfied when the user has selected the
  268.   gadget, and will then be deactivated. The window can now be
  269.   closed.
  270.  
  271. Example5
  272.   Same as Example4, except that the requester is first
  273.   activated when the user double-clicks on the right mouse
  274.   button. This example shows how to create a Double-menu
  275.   requester, and how to monitor the IDCMP flags REQSET and
  276.   REQCLEAR.
  277.  
  278. Example6
  279.   Same as Example5, except that whenever the user double-
  280.   clicks on the right mouse button, we will receive a REQVERIFY
  281.   message, and first when we have replied, will the requester
  282.   be activated. This example shows how to use the REQVERIFY
  283.   flag.
  284.  
  285. Example7
  286.   This program will open a normal window which is connected to
  287.   the Workbench Screen. The window will use all System Gadgets,
  288.   and will close first when the user has selected the System
  289.   gadget Close window. Inside the window we have activated an
  290.   Application requester with three connecting gadgets. Two are
  291.   Boolean gadgets ("OK and "CANCEL"), and one is a String
  292.   gadget.
  293.  
  294. Example8
  295.   Same as Example7, except that it is an Integer gadget.
  296.  
  297. Example9
  298.   Same as Example8, except that it is a Proportional gadget.
  299.  
  300. Example 10
  301.   This example demonstrates how you use a requester with a
  302.   predrawn bitmap. This is very useful when you want colourful
  303.   and catching requesters. The advantage with a special bitmap
  304.   is that if the window which the requester is tied to is
  305.   resized, the drawing will not be destroied.
  306.  
  307.   The graphics data is stored in a separate file called
  308.   "Example10Graphics.c". Both this and the graphical file
  309.   should be compiled separately, then linked together. If you
  310.   have a SAS (Lattice) C Compiler you would do like this:
  311.     lc Example10.c
  312.     lc Example10Graphics.c
  313.     blink with Example10.lnk
  314.  
  315.   This program will NOT try to erase the disk! It is ony a
  316.   demonstration how to use a requester.
  317.  
  318.  
  319.  
  320. 2.6  ALERTS
  321.  
  322. Example1
  323.   This example displays an Alert message at the top of the
  324.   display.
  325.  
  326.  
  327.  
  328. 2.7  MENUS
  329.  
  330. Example1
  331.   This program opens a normal window to which we connect a menu
  332.   strip. The menu consists of four items: Plain, Bold,
  333.   Underlined and Italic. The user can select either Plain or a
  334.   combination of the other styles. (If the user selects Plain
  335.   all other modes will be mutual excluded, but if the user on
  336.   the other hand selects Bold, Underlined or Italic, only the
  337.   Plain option will be mutual excluded.
  338.   
  339.   This example also shows how a program should handle the IDCMP
  340.   flags, and how to collect several messages from one single
  341.   menu event.
  342.  
  343. Example2
  344.   This example is very similar to Example1, but we have this
  345.   time put the edit styles in a subitem box which is connected
  346.   to the one and only item box called "Style".
  347.  
  348. Example3
  349.   This example is very similar to Example2, but the user can
  350.   this time also access the subitems from the keyboard. For
  351.   example, to select Bold the user only needs to press the
  352.   right Amiga key [A] together with the "B" key.
  353.  
  354. Example4
  355.   This program opens a normal window to which we connect a menu
  356.   strip. The menu consists of two items: Readmode and Editmode.
  357.   The readmode item is selected and ghosted, and when the user
  358.   selects the editmode item, it will become disabled (ghosted)
  359.   while the readmode item will be enabled (not ghosted). This
  360.   means that if the program is in "readmode", the user should
  361.   only be able to chose the "editmode", and v.v. The purpose
  362.   with this program is to show how you can use the OnMenu and
  363.   OffMenu functions in order to make an "user-friendly
  364.   interface".
  365.  
  366. Example5
  367.   Exactly as Example1 except that we have changed Intuition's
  368.   checkmark to our own customized "arrow".
  369.  
  370. Example6
  371.   This program opens a normal window to which we connect a menu
  372.   strip. The menu consists of six small dices which are all
  373.   action items. This example shows how you can use Images
  374.   inside a menu.
  375.  
  376. Example7
  377.   This program opens a normal window to which we connect a menu
  378.   strip. The menu consists of one small action item with two
  379.   images.
  380.  
  381. Example8
  382.   Same as Example1 except that we this time will verify any
  383.   menu operations. If the user tries to activate this program's
  384.   menu we check if the position of the pointer is somewhere at
  385.   the top of the window (less than 10 lines down). In that case
  386.   the menu operation will continue as normal, otherwise we
  387.   cancel the menu operation.
  388.  
  389.  
  390.  
  391. 2.8  IDCMP
  392.  
  393. Example1
  394.   This program explains how to use the IDCMP flag MOUSEBUTTONS.
  395.  
  396. Example2
  397.   This program explains how to use the IDCMP flag MOUSEMOVE.
  398.  
  399. Example3
  400.   This program explains how to use the IDCMP flags: NEWSIZE,
  401.   ACTIVEWINDOW and INACTIVEWINDOW.
  402.  
  403. Example4
  404.   This program explains how to use the IDCMP flag SIZEVERIFY.
  405.  
  406. Example5
  407.   This program explains how to use the IDCMP flag RAWKEY.
  408.  
  409. Example6
  410.   This program explains how to use the IDCMP flag VANILLAKEY.
  411.  
  412. Example7
  413.   This program explains how to use the IDCMP flags:
  414.   DISKINSERTED and DISKREMOVED.
  415.  
  416. Example8
  417.   This program explains how to use the IDCMP flag INTUITICKS.
  418.  
  419. Example9
  420.   This program explains how to use the IDCMP flag
  421.   REFRESHWINDOW, and how to optimize the redrawing of the
  422.   window.
  423.  
  424.  
  425.  
  426. 2.9  MISCELLANEOUS
  427.  
  428. Example1
  429.   This example shows how to allocate, and deallocate memory.
  430.  
  431. Example2
  432.   This example shows how to allocate and deallocate memory with
  433.   help of the functions AllocRemember(), and FreeRemember().
  434.  
  435. Example3
  436.   This example shows how to get a copy of the preferences.
  437.  
  438. Example4
  439.   This example shows how to handle double mouse button events.
  440.  
  441. Example5
  442.   This example prints out the current time.
  443.  
  444.